import * as React from "react";

export default function Memo() {
  const [count, setCount] = React.useState<number>(0);

  const countMemo = React.useMemo(() => {
    return count + 1;
  }, [count]);

  React.useEffect(()=>{
    console.log('Memo重新渲染！')
  })

  const handleClick = () => {
    console.log('count被重新赋值')
    setCount(count);
  };
  return (
    <div>
      Count:{countMemo}
      <button onClick={handleClick}></button>
    </div>
  );
}
